
function getBigClassList(){
    $.ajax({
        type:'get',//可选get
        url:'page/bigclass_list',//这里是接收数据的servlet
        dataType:'html',//服务器返回的数据类型 
        success:function(msg){
            document.getElementById("bigClassList").innerHTML=msg;
        },
        error:function(){
            alert('服务器错误');
        }
    });
}

function getClassList(){
    $.ajax({
        type:'get',//可选get
        url:'page/class_list',//这里是接收数据的servlet
        data:'bigClassId=' + document.getElementById("bigClassList").value,
        dataType:'html',//服务器返回的数据类型 
        success:function(msg){
            document.getElementById("classList").innerHTML=msg;
        },
        error:function(){
            alert('服务器错误');
        }
    });
}


function addclasssubmit(){
    var className = document.classform.className;
    if (document.classform.bigClassList.value == 0) {
        alert("请先选择大类");
    }
    else if (className.value.length == 0) {
        alert("请输入种类名");
    } else {
        document.classform.submit();
    };
}

function addbigclasssubmit(){
    var bigClassName = document.bigclassform.bigClassName;
    if (bigClassName.value.length == 0) {
        alert("请输入种类名");
    } else {
        document.bigclassform.submit();
    };
}

function addgoodsubmit(){
    
}




var fileCount = 1;
function addFile(dvID, inputNamePrefix)
{
    var dv = document.getElementById(dvID);
    
    var file = document.createElement("input");
    file.type = "file";
    file.id = file.name = inputNamePrefix + fileCount;
    
    dv.appendChild(file);
    
    var btn = document.createElement("input");
    btn.type = "button";
    btn.id = btn.name = "btn" + fileCount;
    btn.value = "删除" ;

    btn.onclick = function() {
        var b = document.getElementById(btn.id);
        dv.removeChild(b.nextSibling); //remove <br>
        dv.removeChild(b.previousSibling); //file
        dv.removeChild(b); //btn
    };
    dv.appendChild(btn);
    dv.appendChild(document.createElement("br"));
    
    fileCount++;
}